<!--Reference from-->
<!--http://www.jq22.com/jquery-info13300-->
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <title>面签预约</title>
    <link href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="https://cdn.bootcss.com/bootstrap-validator/0.5.3/css/bootstrapValidator.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.2/css/bootstrap-select.min.css">
    <link href="https://cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet" type="text/css">
    <link href="css/my.css" rel="stylesheet" type="text/css">
    <style type="text/css">
        .my-form-h1 {}

        .my-form-label {
            font-size: 16px;
            font-weight: bold;
            color: #e51c23;
        }

    </style>
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
    <script type="text/javascript" src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap-validator/0.5.3/js/bootstrapValidator.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.2/js/bootstrap-select.min.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <script type="text/javascript" src="js/jquery.flexText.min.js"></script>
    <script src="https://cdn.bootcss.com/json2/20160511/json2.min.js"></script>
    <script src="https://cdn.bootcss.com/moment.js/2.18.0/moment.min.js"></script>
    <script src="https://cdn.bootcss.com/moment.js/2.18.0/locale/zh-cn.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="js/my.js"></script>
    <script type="text/javascript">
        var investorAry = [];
        var isAddMode = true;
        function getmeetingdata() {
            var theid = GetRequest()["id"];
            var myapi = restapis;
            myapi.request("serchMQ", null, "id=" + theid, function(result) {
                if (result)
                    pressData(result);
            }, function(e) {});
        }
        function pressData(data) {
            if (data.hasOwnProperty("apply_name")) $("#companyname").text(data.apply_name);
            if (data.hasOwnProperty("actual_address")) $("#actual_address").text(data.actual_address);
            if (data.hasOwnProperty("manage_range")) $("#manage_range").text(data.manage_range);
            if (data.hasOwnProperty("register_money")) $("#register_money").val(data.register_money);
            if (data.hasOwnProperty("register_kind")) $("#register_kind").text(data.register_kind);
            if (data.hasOwnProperty("appointment_time")) $("#appointment_time").val(data.appointment_time);
            if (data.hasOwnProperty("tzfr_name")) $("#tzfr_name").val(data.tzfr_name);
            for (var i = 0; i < data.arr.length; i++) {
                data.arr[i]["order"] = i;
                addAinvestorToList(data.arr[i]);
            }
            if (data.hasOwnProperty("appointment_time")) {
                var theyear = Math.round(data.appointment_time.split("年")[0]);
                var datastr = data.appointment_time.split("年")[1];
                var themonth = Math.round(datastr.split("月")[0]) - 1;
                datastr = datastr.split("月")[1];
                var theday = Math.round(datastr.split("日")[0]);
                var today = new Date(theyear, themonth, theday);
                today.setFullYear(theyear);
                today.setMonth(themonth);
                today.setDate(theday);
                $('#appointment_time_picker').datetimepicker({
                    locale: 'zh-cn',
                    defaultDate: today,
                    enabledDates: [today]
                });
            }
            if (data.hasOwnProperty("appointment_address"))
                $("#appointment_address").val(data.appointment_address);
        }
        $(document).ready(function() {
            var today = new Date();
            $("#appointment_time").attr('min', today);
            var month = new Date(new Date().setMonth(today.getMonth() + 1));
            $("#appointment_time").attr('max', month);
            var targatDate = new Date();
            targatDate.setMonth(targatDate.getMonth()+6);
            targatDate.getDate()- today.getDate();
            var maxDateTo = targatDate.getTime()-today.getTime();
            maxDateTo = maxDateTo/(1000*60*60*24);
            var darry = [];
            for(var i=0;i<maxDateTo;i++){
                var adate = new Date();
                adate.setDate(adate.getDate()+i);
                darry.push(adate);
                //console.log("add a date:"+adate.toDateString());
            }
            $('#appointment_time_picker').datetimepicker({
                locale: 'zh-cn',
                defaultDate: today,
                enabledDates: darry
            });
            $("#thesubmit").on("click",function(events){
                var myapi = restapis;
                var theid= GetRequest()["id"];
                var thetime = $("#appointment_time").val();
                var theaddress = $("#appointment_address").val();
                var theparam = "id="+theid+"&appointment_time="+thetime+"&appointment_address"+theaddress+"&appointment_state=1";
                myapi.request("startMQ",null,theparam,function(result){
                    if(result.result ==0){
                        window.location = "ee_u_progress.html";
                    }else{
                        alert("提交错误，请检查提交的参数.")
                    }
                },function(e){alert("提交错误，请检网络.")});
            });
            getmeetingdata();
        })

    </script>
</head>

<body class="my-body">

    <div style="padding:0px;marging:0px;background-size: cover;overflow-y:visible;">
        <img class="col-xs-4 col-xs-offset-4 img-responsive my-gap-top" src="images/dfa8c6ef0acedc844c59669f4f24fe1a.png">
        <div class="section my-topsection">
            <div class="container" style="vertical-align:mid;">
                <div class="col-xs-12 text-center my-gap-bottom">
                    <!--h3> 企业名称预先核准申请书</h3-->
                </div>
            </div>
            <div class="container">
                <div class="form-group">
                    <label class="clearfix">登记企业名称</label>
                    <label id="companyname" class="my-form-label text-center clearfix">&nbsp;
                    </label>
                </div>
                <div class="form-group">
                    <label class="clearfix">实际经营地址</label>
                    <div id="actual_address" class="my-form-label text-left clearfix">&nbsp;
                    </div>
                </div>
                <div class="form-group">
                    <label class="clearfix">实际经营地址</label>
                    <div id="actual_address" class="my-form-label text-left clearfix">&nbsp;
                    </div>
                </div>
                <div class="form-group">
                    <label>企业注册资本：</label>
                    <label id="register_money" class="my-form-label text-left clearfix">&nbsp;
                    </label>
                </div>
                <div class="form-group">
                    <label>企业注册类型：</label>
                    <label id="register_kind" class="my-form-label text-left clearfix">&nbsp;
                    </label>
                </div>
                <form id="bookform">
                    <div class="form-group">
                        <label class="clearfix">面签预约时间</label>
                        <div class="form-group">
                            <div class='input-group date' id='appointment_time_picker'>
                                <input id="appointment_time" type='text' class="form-control" name="appointment_time" />
                                <span class="input-group-addon">
                        <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="clearfix">面签预约地点</label>
                        <select id="appointment_address" name="appointment_address" class="selectpicker mycompany-select">
                        <option title="小区总部" value="小区总部"><span style="font-size:12;color:#cccccc">园区小区总部，地址是：上海市XX区XX路233号</span></option>
                        <option title="市区总部" value="市区总部"><span style="font-size:12;color:#cccccc">园区市区总部，地址是：上海市XX区XX路233号</span></option>
                        </select>
                    </div>
                    <button id="thesubmit" class="btn btn-primary form-control" type="button">提交</button>
                </form>
            </div>
        </div>
    </div>
    <div class="modal fade" id="addinvestorpanel">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span aria-hidden="true">&times;</span>
                        <span class="sr-only"></span>
                    </button>
                    <h4 id="mysetTitle">投资人</h4>

                </div>
                <div class="modal-body">

                </div>

            </div>
        </div>
    </div>

</body>

</html>
